package com.woniuxy.controller;

import com.woniuxy.pojo.CustomerPrice;
import com.woniuxy.pojo.DatePrice;
import com.woniuxy.service.OrderService;
import com.woniuxy.util.DataGridView;
import com.woniuxy.util.ResultDto;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@RestController
public class OrderController {
    private Logger logger= LoggerFactory.getLogger(this.getClass());
    @Autowired
    private OrderService orderService;
    @GetMapping(value = "orders/selectorder")
    public DataGridView selectOrder(String ordeCustNo){
        return orderService.selectOrderByOrdeCustNo(ordeCustNo);
    }


    /**
     * 查询所有客户的贡献，就是得到该客户贡献了的总金额，以便我们分析报表
     * @return
     */
    @GetMapping(value = "orders/findCustomerPriceTotal")
    public List<CustomerPrice> findCustomerPriceTotal(){
        return orderService.findCustomerPriceTotal();
    }

    /**
     * 这个是在客户贡献分析那里，还有一个是根据年份查询到的年金额
     * @return
     */
    @GetMapping(value = "orders/findYearDatePriceTotal")
    public List<DatePrice> findYearDatePriceTotal(){
        return orderService.findYearDatePrice();
    }

}
